Skip to content

feat(publish): generic anyr publish and apps, api --data @file/- - #108

Merged
duyet merged 4 commits into
mainfrom
feat/generic-publish
Oct 23, 2026
Merged

duyet merged 4 commits into
mainfrom
feat/generic-publish

Conversation

@duyet

@duyet duyet commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

What

Generic, app-agnostic publishing, like anyr api. No app names in Rust.

  • anyr api: --data @file, --data - (stdin), -H key:value (repeatable), --idempotency-key.
  • anyr publish <app> [file|-] [--visibility unlisted|private|public] [--yes] [--dry-run] [--json]: GET /v1/apps/<app>/schema, validate locally, exit 2 with field errors, POST /v1/apps/<app>/submissions with Idempotency-Key = hash of app + canonical payload, print the URL.
  • anyr apps schema|ls|rm|visibility: thin wrappers over the same client.
  • Fix: --data and --method were not value flags in the parser, so anyr api ... --data '{...}' never worked. They are now.

Notes

  • Validator is in-house (src/schema.rs, ~200 lines), not the jsonschema crate: that crate pulls regex and more, which risks the 4 MiB binary cap and the wasm build. Covers type, enum, const, properties, required, additionalProperties, items, prefixItems, size bounds, anyOf/oneOf/allOf/not, local $ref. pattern and format are ignored locally; the server re-validates.
  • Schema is fetched each run (no 1h cache yet).
  • Server contract is coded from the spec and mocked in tests; routes land in duyet/anyrouter feat/app-submissions-api.
  • Public publish asks for confirmation (--yes in scripts).

Tests

cargo test --locked --all-targets, cargo clippy, cargo fmt --check all clean. tests/publish.rs (12): stdin/@file/-H, local validation exit 2 with no POST, stable idempotency key, 404 exit 3, visibility, apps verbs, and a grep test that no app name appears in src/ outside help examples.

🤖 Generated with Claude Code

duyet and others added 3 commits October 21, 2026 15:08
No app names in Rust: schema comes from GET /v1/apps/<app>/schema, validated locally, posted with a stable Idempotency-Key. Also fixes --data and --method not taking values in the flag parser.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Co-authored-by: Duyet Le <me@duyet.net>
Co-authored-by: duyetbot <bot@duyet.net>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Co-authored-by: Duyet Le <me@duyet.net>
Co-authored-by: duyetbot <bot@duyet.net>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Co-authored-by: Duyet Le <me@duyet.net>
Co-authored-by: duyetbot <bot@duyet.net>

@duyetbot duyetbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: validator, auth origin, path encoding, input cap (fixed in this branch), release binary 3.30 MiB (<4 MiB), tests pass.

…ssues

The JSON Schema covers types only. --dry-run now posts to
/submissions?validate_only=1, so it runs the app's full checks without
storing anything. A 422 prints each issue as path: message, fix: ...

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Co-authored-by: Duyet Le <me@duyet.net>
Co-authored-by: duyetbot <bot@duyet.net>

@duyetbot duyetbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delta 58d00af..28b51d3 reviewed: dry-run POSTs ?validate_only=1 without Idempotency-Key, surfaces error.metadata.issues with path/fix, tests cover both. Requires the server to honor validate_only.

duyet added a commit that referenced this pull request Oct 23, 2026
Publish a file (inline JSON) or a folder (manifest, missing-blob PUT,
commit). --id republishes with base_version; a 409 prints the current
version and exits 2. public asks for confirmation unless --yes.

Adds value flags --title, --visibility, --id, --label to the parser
(overlaps the parse.rs fix in #108) and http_put_file for streamed PUT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Co-authored-by: Duyet Le <me@duyet.net>
Co-authored-by: duyetbot <bot@duyet.net>
@duyet
duyet merged commit 3662f3f into main Oct 23, 2026
12 of 18 checks passed
duyet added a commit that referenced this pull request Oct 23, 2026
Publish a file (inline JSON) or a folder (manifest, missing-blob PUT,
commit). --id republishes with base_version; a 409 prints the current
version and exits 2. public asks for confirmation unless --yes.

Adds value flags --title, --visibility, --id, --label to the parser
(overlaps the parse.rs fix in #108) and http_put_file for streamed PUT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Co-authored-by: Duyet Le <me@duyet.net>
Co-authored-by: duyetbot <bot@duyet.net>
duyet added a commit that referenced this pull request Oct 23, 2026
Publish a file (inline JSON) or a folder (manifest, missing-blob PUT,
commit). --id republishes with base_version; a 409 prints the current
version and exits 2. public asks for confirmation unless --yes.

Adds value flags --title, --visibility, --id, --label to the parser
(overlaps the parse.rs fix in #108) and http_put_file for streamed PUT.

Co-authored-by: duyetbot <bot@duyet.net>
@duyet
duyet deleted the feat/generic-publish branch October 25, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants